package com.hf.lookatme.zview.activitys;

import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import com.hf.lookatme.R;
import com.hf.lookatme.commons.CommonMethod;
import com.orhanobut.logger.Logger;

import butterknife.ButterKnife;
import butterknife.InjectView;
import butterknife.OnClick;

/**
 * Created by JoeShiguang on 2015/6/2.
 */
public class Activity_PartTimeJob_Collider extends Activity_Base {

  private static String TAG = "Activity_PartTimeJob_Collider";

  @InjectView(R.id.textView_actionBar_title)
  TextView textView_actionBar_title;

  @InjectView(R.id.imageView_actionBar_back)
  ImageView imageButton_actionBar_back;

  @InjectView(R.id.imageView_actionBar_operation_useIcon)
  ImageView imageView_actionBar_resetConditions;

  @InjectView(R.id.imageView_partTimeJob_collider_colliderInfo_sex_man)
  ImageView imageView_check_man;

  @InjectView(R.id.imageView_partTimeJob_collider_colliderInfo_sex_woman)
  ImageView imageView_check_woman;

  @InjectView(R.id.ediText_partTimeJob_collider_name)
  EditText editText_name;

  @InjectView(R.id.ediText_partTimeJob_collider_telNum)
  EditText editText_telNum;

  @InjectView(R.id.textView_partTimeJob_collider_location)
  TextView textView_workLocation;

  @InjectView(R.id.textView_partTimeJob_collider_salary)
  TextView textView_workSalary;

  @InjectView(R.id.textView_partTimeJob_collider_time)
  TextView textView_workTime;

  private int currentChoosedSex = 0; //0:男，1:女

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_parttimejob_collider);
    ButterKnife.inject(this);
    try {
      initActionBar();
      initControls();
    } catch (Exception ex) {
      Logger.e(ex.getMessage());
    }
  }

  private void initActionBar() {

    textView_actionBar_title.setText(getResources().getString(R.string.partTimeJobCollider));
    imageView_actionBar_resetConditions.setImageResource(R.drawable.shuaxin);
    imageButton_actionBar_back.setVisibility(View.VISIBLE);
    imageView_actionBar_resetConditions.setVisibility(View.VISIBLE);
  }

  private void initControls() {
    imageView_check_man.setSelected(true);
  }

  @OnClick(R.id.linearLayout_parttimejob_sex_man)
  void onLayout_chooseManClicked(View view) {
    if (CommonMethod.isFastDoubleClick()) {
      return;
    }
    if (currentChoosedSex == 0) {
      return;
    }
    imageView_check_man.setSelected(true);
    imageView_check_woman.setSelected(false);
    currentChoosedSex = 0;
  }

  @OnClick(R.id.linearLayout_parttimejob_sex_woman)
  void onLayout_chooseWomanClicked(View view) {
    if (CommonMethod.isFastDoubleClick()) {
      return;
    }
    if (currentChoosedSex == 1) {
      return;
    }
    imageView_check_man.setSelected(false);
    imageView_check_woman.setSelected(true);
    currentChoosedSex = 1;
  }

  @OnClick(R.id.imageView_actionBar_back)
  void onImageView_actionBar_backClicked(View view) {
    if (CommonMethod.isFastDoubleClick()) {
      return;
    }
    Activity_PartTimeJob_Collider.this.finish();
  }

  @OnClick(R.id.textView_actionBar_operation)
  void onTextView_actionBar_resetConditionsClicked(View view) {
    if (CommonMethod.isFastDoubleClick()) {
      return;
    }
  }


}
